package com.concurrent.sample.business.event.param.trade;

import com.concurrent.sample.business.common.enums.EventTypeEnum;
import com.concurrent.sample.business.common.enums.SideEnum;
import com.concurrent.sample.business.event.entity.EventEntity;
import com.concurrent.sample.business.trade.entity.TradeOrderEntity;
import com.concurrent.sample.common.enums.ExceptionHandleTypeEnum;
import java.util.Optional;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class CreateTradeEventParamParam implements BaseTradeEventParam {

  private ExceptionHandleTypeEnum exceptionHandleType;

  private EventEntity event;

  private TradeOrderEntity order;

  @Override
  public EventTypeEnum getEventType() {
    return Optional.ofNullable(event).map(EventEntity::getEventType).orElse(null);
  }

  @Override
  public SideEnum getSide() {
    return Optional.ofNullable(event).map(EventEntity::getSide).orElse(null);
  }
}
